<!DOCTYPE>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Global stylesheets -->
    <link href="${base}/css/icons/icomoon/styles.css" rel="stylesheet" type="text/css">
    <link href="${base}/css/base/minified/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="${base}/css/base/minified/core.min.css" rel="stylesheet" type="text/css">
    <link href="${base}/css/base/minified/components.min.css" rel="stylesheet" type="text/css">
    <link href="${base}/css/base/minified/colors.min.css" rel="stylesheet" type="text/css">
    <!-- /global stylesheets -->
    <link href="${base}/css/base/style.css" rel="stylesheet" type="text/css">
    <!-- Core JS files -->
    <script type="text/javascript" src="${base}/js/plugins/loaders/pace.min.js"></script>
    <script type="text/javascript" src="${base}/js/core/libraries/jquery.min.js"></script>
    <script type="text/javascript" src="${base}/js/core/libraries/bootstrap.min.js"></script>
    <script type="text/javascript" src="${base}/js/plugins/loaders/blockui.min.js"></script>
    <script type='text/javascript' src='${base}/js/plugins/layer/layer.js'></script>


    <script>
        var appPath='${base}/';
    </script>
    <!-- /core JS files -->
    <script type="text/javascript" src="${base}/js/core/app.js"></script>

    <script type="text/javascript" src="${base}/js/util.js"></script>
    <#assign _CODE = "${RequestParameters['code']}" />
</head>
<body style="background: white">
    <div class="ibox-content" style="padding: 10px">
        <input type="hidden" name="opercode" id="opercode" value="${_CODE}"/>
        <table class="editTable table  table-bordered" style="max-width: 700px;">
            <tr style="display: none;" id="remarkTR">
                <th colspan="2" style="text-align: center;">密码安全级别较低，请重设密码不少于5位长度(初始密码为：123)。<br/>低：纯数字或字母、中：字母+数字、强：字母+数字+特殊字符、非常强：字母+数字+特殊字符+大写字母</th>
            </tr>
            <#--<#if _CODE?length==0>-->
                <#--<tr>-->
                    <#--<th>旧密码：</th>-->
                    <#--<td><input  type="password" id="oldPasswd" name="oldPasswd" size="30" class="form-control" style="width: 200px"/></td>-->
                <#--</tr>-->
            <#--</#if>-->

            <tr>
                <th>新密码：</th>
                <td><input type="password" id="newPasswd" onkeyup="evaPwd(this.value)" size="30" class="form-control" style="width: 200px;float: left"/>&nbsp;密码强度：
                    <span id="evaDisp" style="display: inline-block; width: 80px; background-color: blue; color: white; text-align: center">弱</span></td>
            </tr>
            <tr>
                <th>再输一遍：</th>
                <td><input type="password" id="newPasswd2" size="30" class="form-control" style="width: 200px"/></td>
            </tr>
        </table>
    </div>
    <div style="text-align: center;margin-top: 10px">
        <button style="width: 120px" type="button" onclick="save()" class="btn btn-primary">提交</button>
    </div>
<script>
    var d=0;
    function evaPwd(pwd) {
        var ret = evaluatePwd(pwd);
        var dispStr = "";
        if (ret <= 1) {
            $("#evaDisp").css("background-color","blue");
            dispStr = '弱';
        } else if (ret <= 2) {
            $("#evaDisp").css("background-color","green");
            dispStr = '中';
        } else if (ret <= 3) {
            $("#evaDisp").css("background-color","orange");
            dispStr = '强';
        } else {
            $("#evaDisp").css("background-color","red");
            dispStr = '非常强';
        }
        $("#evaDisp").html(dispStr);
    }

    function save() {
        var oldPasswd;
        var newPasswd;
        var newPasswd2;
        <#if _CODE?length==0>
        if(
            (newPasswd=checkPassword1($("#newPasswd")))===false ||
            (newPasswd2=checkEqualTo($("#newPasswd"),$("#newPasswd2")))===false
        ) {
            return;
        }
        <#else>
            if(
                    (newPasswd=checkPassword1($("#newPasswd")))===false ||
                    (newPasswd2=checkEqualTo($("#newPasswd"),$("#newPasswd2")))===false
            ) {
                return;
            }
        </#if>
        var opercode=$('#opercode').val();
        post('pl/operator/changePwd',{opercode:opercode,password:newPasswd,oldPasswd:oldPasswd},function (result) {
            if(result.code==0){
                dialogClose();
            }
        });
    }
</script>
</body>
</html>
